﻿Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Linq
Imports System.Web
Imports Forecast.Logica.Enumeradores
Imports Forecast.Logica.Modelos
Namespace Servicios
    Public Class ServUOM
        Public Function SearchUOM() As DataTable
            Dim cn As New SqlConnection()
            Dim cmd As New SqlCommand()
            Dim da As SqlDataAdapter
            Dim ds As DataSet

            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString.ToString
            cn.ConnectionString = ConnString
            cmd = New SqlCommand()
            cmd.Connection = cn
            cmd.CommandText = "FC_UOM_Search"
            cmd.CommandType = CommandType.StoredProcedure

            da = New SqlDataAdapter()
            da.SelectCommand = cmd
            ds = New DataSet()
            da.Fill(ds)
            Return ds.Tables(0)
        End Function

        Public Function SearchUOM_PorEntity(IdEntityF As Integer) As DataTable
            Dim cn As New SqlConnection()
            Dim cmd As New SqlCommand()
            Dim da As SqlDataAdapter
            Dim ds As DataSet

            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString.ToString
            cn.ConnectionString = ConnString
            cmd = New SqlCommand()
            cmd.Connection = cn
            cmd.CommandText = "FC_UOM_Search_PorEntity"
            cmd.CommandType = CommandType.StoredProcedure

            cmd.Parameters.Add("@IdEntityF", Data.SqlDbType.Int)
            cmd.Parameters("@IdEntityF").Value = IdEntityF

            da = New SqlDataAdapter()
            da.SelectCommand = cmd
            ds = New DataSet()
            da.Fill(ds)
            Return ds.Tables(0)
        End Function


    End Class
End Namespace
